<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
         
        <div class="layui-form-item">
            <label class="layui-form-label">企业</label>
            <div class="layui-input-block">
                <select name="company_id" lay-verify="required" lay-filter="qwe" class="layui-input">
                    <option value="">--请选择--</option>
                    {volist name="company" id="v"}
                    <option value="{$v.id}" {if condition="$row.company_id eq $v.id"}selected{/if}>{$v.company_name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">职位名称</label>
            <div class="layui-input-block">
                <input type="text" name="position_name" lay-verify="required" class="layui-input"  placeholder="请输入职位名称" value="{$row.position_name|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">工资薪资</label>
            <div class="layui-input-block">
                <input type="text" name="salary" class="layui-input" lay-verify="required"  placeholder="请输入工资薪资" value="{$row.salary|default=''}">
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label">薪资类型</label>
            <div class="layui-input-block">
                <select name="salary_type" lay-verify="required" lay-filter="qwe" class="layui-input">
                    <option value="">--请选择--</option>
                    <option value="1" {if condition="$row.salary_type eq 1"}selected{/if}>元/单</option>
                    <option value="2" {if condition="$row.salary_type eq 2"}selected{/if}>元/小时</option>
                    <option value="3" {if condition="$row.salary_type eq 3"}selected{/if}>元/天</option>
                    <option value="4" {if condition="$row.salary_type eq 4"}selected{/if}>元/周</option>
                    <option value="5" {if condition="$row.salary_type eq 5"}selected{/if}>元/月</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否全国</label>
                <div class="layui-input-block">
                    <input type="radio" name="isit_nationwide" lay-filter="levelM" class="layui-input" value="1" title="否" {if condition="$row.isit_nationwide eq 1"}checked{/if}>
                    <input type="radio" name="isit_nationwide" lay-filter="levelM" class="layui-input" value="2" title="是" {if condition="$row.isit_nationwide eq 2"}checked{/if}>
                </div>
        </div>
        <input type="hidden" id="quanguo" value="{$row.isit_nationwide}">
        <div class="layui-form-item" id="sheng">
            <div class="layui-col-md4">
                <div class="layui-form-item">
                    <label class="layui-form-label">省</label>
                    <div class="layui-input-block">
                        <select name="region_province" class="layui-input" lay-filter="province">
                            <option value="0">请选择</option>
                            {volist name="province" id="v"}
                                <option value="{$v.code}" {if condition="$row.region_province eq $v.code"}selected{/if}>{$v.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>

            <div class="layui-col-md4" id="sheng1">
                <div class="layui-form-item">
                    <label class="layui-form-label">市</label>
                    <div class="layui-input-block">
                        <select name="region_city" class="layui-input" id="city" lay-filter="city">
                            {volist name="city" id="v"}
                            <option value="{$v.code}" {if condition="$row.region_city eq $v.code"}selected{/if}>{$v.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>

            <div class="layui-col-md4" id="sheng2">
                <div class="layui-form-item">
                    <label class="layui-form-label">区</label>
                    <div class="layui-input-block">
                        <select name="region_region" class="layui-input" id="area" lay-filter="area">
                            {volist name="region" id="v"}
                            <option value="{$v.code}" {if condition="$row.region_region eq $v.code"}selected{/if}>{$v.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
            </div>
        </div> 
        <div class="layui-form-item">
            <label class="layui-form-label">工作描述</label>
            <div class="layui-input-block">
                <textarea name="job_description" rows="5" class="layui-textarea" placeholder="请输入工作描述">{$row.job_description|default=''}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">招聘日期-开始</label>
            <div class="layui-input-block">
                <input type="text" name="selection_date_start" class="layui-input" id="test1" readonly placeholder="请选择开始时间" value="{$row.selection_date_start|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">招聘日期-结束</label>
            <div class="layui-input-block">
                <input type="text" name="selection_date_end" class="layui-input" id="test2" readonly  placeholder="请选择结束时间" value="{$row.selection_date_end|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">招聘时段-开始</label>
            <div class="layui-input-block">
                <input type="text" name="work_time_start" class="layui-input" id="test3" readonly placeholder="请选择开始时间" value="{$row.work_time_start|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">招聘时段-结束</label>
            <div class="layui-input-block">
                <input type="text" name="work_time_end" class="layui-input" id="test4" readonly placeholder="请选择结束时间" value="{$row.work_time_end|default=''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">第一个联系内容</label>
            <div class="layui-input-block">
                <textarea name="contact_message" rows="5" class="layui-textarea" placeholder="请输入联系内容">{$row.contact_message|default=''}</textarea>
                <tip>请设置聊天内容。</tip>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">获取联系方式后信息</label>
            <div class="layui-input-block">
                <textarea name="greeting_message" rows="5" class="layui-textarea" placeholder="请输入获取联系方式后信息">{$row.greeting_message|default=''}</textarea>
                <tip>请设置聊天打招呼语，推荐联系方式。</tip>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">联系类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="contact_type" lay-filter="levelS" class="layui-input" value="1" title="手机" {if condition="$row.contact_type eq 1"}checked{/if}>
                    <input type="radio" name="contact_type" lay-filter="levelS" class="layui-input" value="2" title="QQ" {if condition="$row.contact_type eq 2"}checked{/if}>
                    <input type="radio" name="contact_type" lay-filter="levelS" class="layui-input" value="3" title="微信" {if condition="$row.contact_type eq 3"}checked{/if}>
                </div>
        </div>
        <input type="hidden" id="lxlx" value="{$row.contact_type}">
        <div class="layui-form-item" id="sj" style="display: none;">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" name="phone_number" class="layui-input"  placeholder="请输入手机号" value="{$job_position_contact_phone.phone_number|default=''}">
            </div>
        </div>
        <div class="layui-form-item" id="sj1" style="display: none;">
            <label class="layui-form-label">最大报名数</label>
            <div class="layui-input-block">
                <input type="text" name="recruit_num" class="layui-input"  placeholder="请输入最大报名数" value="{$job_position_contact_phone.number|default=''}">
            </div>
        </div>
        <div class="layui-form-item" id="qq" style="display: none;">
            <label class="layui-form-label">QQ号</label>
            <div class="layui-input-block">
                <input type="text" name="qq_number" class="layui-input"  placeholder="请输入QQ号" value="{$job_position_contact_qq.qq_number|default=''}">
            </div>
        </div>
       
        <div class="layui-form-item" id="qq1" style="display: none;">
            <label class="layui-form-label">QQ二维码</label>
            <div class="layui-input-block layuimini-upload">
                <input name="qq_qr_code" class="layui-input layui-col-xs6" readonly  placeholder="请上传QQ二维码" value="{$job_position_contact_qq.qq_qr_code|default=''}">
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="qq_qr_code" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="qq_qr_code"><i class="fa fa-upload"></i> 上传</a></span>
                </div>
            </div>
        </div>

        <div class="layui-form-item" id="qq2" style="display: none;">
            <label class="layui-form-label">最大报名数</label>
            <div class="layui-input-block">
                <input type="text" name="qqrecruit_num" class="layui-input"  placeholder="请输入最大报名数" value="{$job_position_contact_qq.number|default=''}">
            </div>
        </div>
        <div class="layui-form-item" id="wx" style="display: none;">
            <label class="layui-form-label">微信号</label>
            <div class="layui-input-block">
                <input type="text" name="wechat_number" class="layui-input"  placeholder="请输入微信号" value="{$job_position_contact_wechat.wechat_number|default=''}">
            </div>
        </div>
        <div class="layui-form-item" id="wx1" style="display: none;">
            <label class="layui-form-label">微信二维码</label>
            <div class="layui-input-block layuimini-upload">
                <input name="wechat_qr_code" class="layui-input layui-col-xs6" readonly  placeholder="请上传微信二维码" value="{$job_position_contact_wechat.wechat_qr_code|default=''}">
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="wechat_qr_code" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="wechat_qr_code"><i class="fa fa-upload"></i> 上传</a></span>
                </div>
            </div>
        </div>
        <div class="layui-form-item" id="wx2">
            <label class="layui-form-label">最大报名数</label>
            <div class="layui-input-block">
                <input type="text" name="wxrecruit_num" class="layui-input"  placeholder="请输入最大报名数" value="{$job_position_contact_wechat.number|default=''}">
            </div>
        </div>
        {if condition="empty($company_id)"}
        <div class="layui-form-item">
            <label class="layui-form-label">性别要求</label>
                <div class="layui-input-block">
                    <input type="radio" name="gender_requirement" lay-filter="levelB" class="layui-input" value="1" title="男" {if condition="$row.gender_requirement eq 1"}checked{/if}>
                    <input type="radio" name="gender_requirement" lay-filter="levelB" class="layui-input" value="2" title="女" {if condition="$row.gender_requirement eq 2"}checked{/if}>
                    <input type="radio" name="gender_requirement" lay-filter="levelB" class="layui-input" value="3" title="不限" {if condition="$row.gender_requirement eq 3"}checked{/if}>
                </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">工作经验</label>
                <div class="layui-input-block">
                    <input type="radio" name="work_experience" lay-filter="levelg" class="layui-input" value="0" title="无需经验" {if condition="$row.work_experience eq 0"}checked{/if}>
                    <input type="radio" name="work_experience" lay-filter="levelg" class="layui-input" value="1" title="需要经验" {if condition="$row.work_experience eq 1"}checked{/if}>
                </div>
        </div>
 

        <div class="layui-form-item">
            <label class="layui-form-label">最小年龄</label>
            <div class="layui-input-block">
                <input type="number" name="min_age" class="layui-input"  placeholder="请输入最小年龄" value="{$row.min_age|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">最大年龄</label>
            <div class="layui-input-block">
                <input type="number" name="max_age" class="layui-input"  placeholder="请输入最大年龄" value="{$row.max_age|default=''}">
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">职位要求</label>
            <div class="layui-input-block">
                <textarea name="experience_requirement" rows="5" class="layui-textarea" placeholder="请输入职位要求">{$row.experience_requirement|default=''}</textarea>
            </div>
        </div>
        
        <div class="layui-form-item">
            <label class="layui-form-label">招聘类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="cur_type" lay-filter="levelzp" class="layui-input" value="1" title="到期时间" {if condition="$row.cur_type eq 1"}checked{/if}>
                    <input type="radio" name="cur_type" lay-filter="levelzp" class="layui-input" value="2" title="招聘人数" {if condition="$row.cur_type eq 2"}checked{/if}>
                </div>
        </div>
        <input type="hidden" id="zplx" value="{$row.cur_type}">
 
        <div class="layui-form-item" id="dq" style="display: none;">
            <label class="layui-form-label">到期时间</label>
            <div class="layui-input-block">
                <input type="text" name="expiration_date" class="layui-input" id="test5"  readonly  placeholder="请选择到期时间" value="{$row.expiration_date|default=''}">
            </div>
        </div>
        <div class="layui-form-item" id="rs" style="display: none;">
            <label class="layui-form-label">招聘人数</label>
            <div class="layui-input-block">
                <input type="number" name="expected_num" class="layui-input"  placeholder="请输入招聘人数" value="{$row.expected_num|default=''}">
            </div>
        </div>
       
        
        <div class="layui-form-item">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-block">
                {volist name="category" id="v"}
                <input type="checkbox" class="layui-input" name="category_id[]" title="{$v.name}" value="{$v.id}" {if condition="in_array($v.id,$categoryid)"}checked{/if}>
                {/volist}
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">职位标签</label>
            <div class="layui-input-block">
                <input type="text" name="tags" class="layui-input"  placeholder="请输入职位标签" value="{$row.tags|default=''}">
                <tip>请设输入职位标签，多个用英文逗号隔开。</tip>
            </div>
        </div>

             
        <div class="layui-form-item">
            <label class="layui-form-label">标签</label>
            <div class="layui-input-block">
                <select name="label"  class="layui-input">
                    <option value="">--请选择--</option>
                    <option value="1" {if condition="$row.label eq 1"}selected{/if}>近期活跃</option>
                    <option value="2" {if condition="$row.label eq 2"}selected{/if}>回复及时</option>
                    <option value="3" {if condition="$row.label eq 3"}selected{/if}>快</option>
                </select>
            </div>
        </div>
  
        <div class="layui-form-item">
            <label class="layui-form-label">标题标签</label>
            <div class="layui-input-block">
                <select name="title_tag"  class="layui-input">
                    <option value="">--请选择--</option>
                    <option value="1" {if condition="$row.title_tag eq 1"}selected{/if}>新</option>
                    <option value="2" {if condition="$row.title_tag eq 2"}selected{/if}>急</option>
                </select>
            </div>
        </div>
        {/if}
        {if condition="$admintype eq 1"}
        <div class="layui-form-item">
            <label class="layui-form-label">审核状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="cur_status" lay-filter="levelzt" class="layui-input" value="1" title="已上架" {if condition="$row.cur_status eq 1"}checked{/if}>
                    <input type="radio" name="cur_status" lay-filter="levelzt" class="layui-input" value="2" title="已下架" {if condition="$row.cur_status eq 2"}checked{/if}>
                    <input type="radio" name="cur_status" lay-filter="levelzt" class="layui-input" value="3" title="待审核" {if condition="$row.cur_status eq 3"}checked{/if}>
                    <input type="radio" name="cur_status" lay-filter="levelzt" class="layui-input" value="4" title="审核驳回" {if condition="$row.cur_status eq 4"}checked{/if}>
                </div>
        </div>
        {/if}

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script type="text/javascript">
    layui.use(['form','upload','laydate'], function(){
        var form = layui.form;
        var upload = layui.upload;
        var laydate = layui.laydate;
        $ = layui.$;
        quanguo = $("#quanguo").val()
        if(quanguo == 1){
            $("#sheng").show();
            $("#sheng1").show();
            $("#sheng2").show();
        }else{
            $("#sheng").hide();
            $("#sheng1").hide();
            $("#sheng2").hide();
        }
        lxlx = $("#lxlx").val()
        if(lxlx == 1){
                $("#sj").show();
                $("#sj1").show();
                $("#qq").hide();
                $("#qq1").hide();
                $("#qq2").hide();
                $("#wx").hide();
                $("#wx1").hide();
                $("#wx2").hide();
            }else if(lxlx == 2){
                $("#sj").hide();
                $("#sj1").hide();
                $("#qq").show();
                $("#qq1").show();
                $("#qq2").show();
                $("#wx").hide();
                $("#wx1").hide();
                $("#wx2").hide();
            }else{
                $("#sj").hide();
                $("#sj1").hide();
                $("#qq").hide();
                $("#qq1").hide();
                $("#qq2").hide();
                $("#wx").show();
                $("#wx1").show();
                $("#wx2").show();
            }
            zplx = $("#zplx").val()
            if(zplx == 1){
                $("#dq").show();
                $("#rs").hide();
            }else if(zplx == 2){
                $("#dq").hide();
                $("#rs").show();
            }else{
                $("#dq").hide();
                $("#rs").hide();
            }
        // 直接调用
        laydate.render({
            elem: '#test1' //指定元素
            ,type:'date',
            trigger:'click'
        });
        laydate.render({
            elem: '#test2' //指定元素
            ,type:'date',
            trigger:'click'
        });
        laydate.render({
            elem: '#test3' //指定元素
            ,type:'time',
            trigger:'click'
        });
        laydate.render({
            elem: '#test4' //指定元素
            ,type:'time',
            trigger:'click'
        });
        laydate.render({
            elem: '#test5' //指定元素
            ,type:'datetime',
            trigger:'click'
        });
        form.on('radio(levelM)', function(data){
            var level = data.value;//被点击的radio的value值
            //TODO 下面是我具体业务的处理代码，可忽略 ...
            if(level == 1){
                $("#sheng").show();
                $("#sheng1").show();
                $("#sheng2").show();
            }else{
                $("#sheng").hide();
                $("#sheng1").hide();
                $("#sheng2").hide();
            }
        });
        form.on('radio(levelzp)', function(data){
            var level = data.value;//被点击的radio的value值
            //TODO 下面是我具体业务的处理代码，可忽略 ...
            if(level == 1){
                $("#dq").show();
                $("#rs").hide();
            }else if(level == 2){
                $("#dq").hide();
                $("#rs").show();
            }else{
                $("#dq").hide();
                $("#rs").hide();
            }
        });
        form.on('radio(levelS)', function(data){
            var level = data.value;//被点击的radio的value值
            //TODO 下面是我具体业务的处理代码，可忽略 ...
            if(level == 1){
                $("#sj").show();
                $("#sj1").show();
                $("#qq").hide();
                $("#qq1").hide();
                $("#qq2").hide();
                $("#wx").hide();
                $("#wx1").hide();
                $("#wx2").hide();
            }else if(level == 2){
                $("#sj").hide();
                $("#sj1").hide();
                $("#qq").show();
                $("#qq1").show();
                $("#qq2").show();
                $("#wx").hide();
                $("#wx1").hide();
                $("#wx2").hide();
            }else{
                $("#sj").hide();
                $("#sj1").hide();
                $("#qq").hide();
                $("#qq1").hide();
                $("#qq2").hide();
                $("#wx").show();
                $("#wx1").show();
                $("#wx2").show();
            }
        });

    
  

        form.on('select(province)', function(data) {
                var majorid = data.value
                $.ajax({
                    url: '{:url("admin/position/province")}',
                    type: 'post',
                    data: {
                        id: majorid
                    },
                    dataType: 'json',
                    success: function(data) {
                        $('#city').html(JSON.stringify(data));
                        form.render('select');
                    }
                })
        });

        form.on('select(city)', function(data) {
                var majorid = data.value
                $.ajax({
                    url: '{:url("admin/position/city")}',
                    type: 'post',
                    data: {
                        id: majorid
                    },
                    dataType: 'json',
                    success: function(data) {
                        $('#area').html(JSON.stringify(data));
                        form.render('select');
                    }
                })
        });
 
        

    });
</script>